<template>
  <div class="main">
    <el-row
      :class="isRejecded == 1 ? 'topContent topContentReject' : 'topContent'"
    >
      <el-col :span="14">
        <div class="titles">
          <i class="icon iconfont iconfanhui1" @click="goBackOne"></i>
          <span class="titleTop">{{ title ? title : '制作工资表' }}</span>
          <span class="issued" v-if="isRejecded == 1">已驳回</span>
        </div>
        <div v-if="isRejecded == 1" class="rejectReason">
          驳回原因：{{ rejectReason || '--' }}
        </div>
      </el-col>
      <el-col :span="10" class="alignRight">
        <div class="btnBox">
          <el-link
            type="primary"
            @click="downLoad(salaryOperateType)"
            class="uploadBtn"
            >点击下载操作说明</el-link
          >
          <el-button
            round
            plain
            @click="downLoad(salaryExcelType)"
            class="salaryAccountBut"
          >
            工资表导入模板
          </el-button>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  name: 'salaryTopTitle',
  props: [
    'salaryOperate',
    'salaryExcel',
    'title',
    'isRejecded',
    'rejectReason',
  ],
  data() {
    return {
      salaryOperateType: '',
      salaryExcelType: '',
    }
  },
  created() {
    this.salaryOperateType = this.salaryOperate
      ? 'salaryOperate'
      : 'csSalaryOperate'
    this.salaryExcelType = this.salaryExcel ? 'salaryExcel' : 'csSalaryExcel'
  },
  methods: {
    downLoad(type) {
      this.axios({
        method: 'post',
        url: 'api-su/salary/expand/findurl',
        data: {
          name: type,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            window.open(response.data.result.url)
          } else {
            this.$message({
              type: 'error',
              message: response.data.msg,
            })
          }
        })
        .catch((error) => {})
    },
    goBackOne() {
      this.$emit('gobackTriser')
    },
  },
}
</script>
<style scoped lang="less">
.main {
  background: #fff;
  // padding: 0 24px;
}
.topContent {
  border-bottom: 1px solid #e3e7e9;
  height: 56px;
  line-height: 54px;
  padding: 0 24px;
  // margin: 24px 24px 0 24px;
  // .titles{
  //     margin-top: 21px;
  // }
  .titleTop {
    font: bold 18px Microsoft YaHei;
    color: #333333;
  }
  .alignRight {
    text-align: right;
    // line-height: 54px;
    .btnBox {
      overflow: hidden;
    }
  }
  .alignRightReject {
    line-height: 90px;
  }
  .salaryAccountBut {
    width: 136px;
    height: 32px;
    line-height: 30px;
    border: 1px solid #009588;
    border-radius: 21px;
    font-size: 14px;
    color: #fff;
    text-align: center;
    background: #009588;
    padding: 0;
    margin-left: 10px;
    margin-top: 12px;
    &:hover {
      opacity: 0.8;
    }
  }
  .uploadBtn {
    line-height: 18px;
  }
}
.topContentReject {
  height: 90px;
}
.rejectReason {
  font-size: 14px;
  line-height: 14px;
  margin-top: 12px;
  padding-left: 30px;
  color: #d41212;
}
.issued {
  border: 1px solid #fe9900;
  font-size: 14px;
  color: #fe9900;
  background: #fbf1e0;
  padding: 2px 5px;
  margin-left: 10px;
}
</style>
